package book;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 74646
 * Date: 2022-02-10
 * Time: 12:54
 */
public class Book {
    private String name; //书名
    private String author; //作者
    private double price; //价格
    private String type; //类型
    private boolean isBorrowed; //是否借出

    //构造方法，在创建图书的时候就是未借出（false）可以不用传 isBorrowed 参数
    public Book(String name, String author, String type,double price) {
        this.name = name;
        this.author = author;
        this.type = type;
        this.price = price;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public boolean isBorrowed() {
        return isBorrowed;
    }

    public void setBorrowed(boolean borrowed) {
        isBorrowed = borrowed;
    }

    @Override
    public String toString() {
        return "Book{" +
                "  书名：'" + name + '\'' +
                ", 作者：'" + author + '\'' +
                ", 价格：'" + price +'\'' +
                ", 类型：'" + type + '\'' +
                ", " + ((isBorrowed==true)? "已借出" :  "未借出") +
                '}';
    }
}
